<!DOCTYPE html>












  


<html class="theme-next muse use-motion" lang="cn">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">






  
  
    
      
    
    
      
    
  <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
  <link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-flash.min.css" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



















  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic|Monda:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="We work in the dark to serve the light。  本文将分享本人在学习yara时的一些心得，并在后面给出使用yara来防御CobaltStrike的方法。">
<meta name="keywords" content="Persistence">
<meta property="og:type" content="article">
<meta property="og:title" content="使用yara防御恶意软件">
<meta property="og:url" content="https://lengjibo.github.io/yara/index.html">
<meta property="og:site_name" content="冷逸的个人博客|开往安河桥北~">
<meta property="og:description" content="We work in the dark to serve the light。  本文将分享本人在学习yara时的一些心得，并在后面给出使用yara来防御CobaltStrike的方法。">
<meta property="og:locale" content="cn">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/0.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/1.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/2.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/3.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/4.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/5.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/6.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/7.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/8.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/9.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/10.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/11.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/12.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/13.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/14.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/15.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/16.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/17.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/18.png">
<meta property="og:image" content="https://lengjibo.github.io/images/yara/19.png">
<meta property="og:updated_time" content="2020-10-11T12:12:36.613Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用yara防御恶意软件">
<meta name="twitter:description" content="We work in the dark to serve the light。  本文将分享本人在学习yara时的一些心得，并在后面给出使用yara来防御CobaltStrike的方法。">
<meta name="twitter:image" content="https://lengjibo.github.io/images/yara/0.png">



  <link rel="alternate" href="/../../.deploy_git/atom.xml" title="冷逸的个人博客|开往安河桥北~" type="application/atom+xml" />




  <link rel="canonical" href="https://lengjibo.github.io/yara/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用yara防御恶意软件 | 冷逸的个人博客|开往安河桥北~</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="cn">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">冷逸的个人博客|开往安河桥北~</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Startseite</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />Über</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />Kategorien</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archiv</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-book">
    <a href="/book/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-book"></i> <br />book</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://lengjibo.github.io/yara/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="冷逸">
      <meta itemprop="description" content="做一个温柔的人...">
      <meta itemprop="image" content="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="冷逸的个人博客|开往安河桥北~">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用yara防御恶意软件
              
            
          </h1>
        

        <div class="post-meta">
        
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Veröffentlicht am</span>
              

              
                
              

              <time title="Post created: 2020-10-11 19:52:45 / Updated at: 20:12:36" itemprop="dateCreated datePublished" datetime="2020-10-11T19:52:45+08:00">2020-10-11</time>
            

            
              

              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">in</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/RedTeam/" itemprop="url" rel="index"><span itemprop="name">RedTeam</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             Views:  
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>We work in the dark to serve the light。</p>
<hr>
<p>本文将分享本人在学习yara时的一些心得，并在后面给出使用yara来防御CobaltStrike的方法。</p>
<a id="more"></a>
<h2 id="yara简介"><a href="#yara简介" class="headerlink" title="yara简介"></a>yara简介</h2><p>yara是一个基于规则的恶意样本分析工具，旨在帮助蓝队或安全研究员防御和分析恶意软件，其官网地址为<a href="https://virustotal.github.io/yara/。你可以使用yara基于文本或二进制来标记恶意软件家族来达到各种目的。" target="_blank" rel="noopener">https://virustotal.github.io/yara/。你可以使用yara基于文本或二进制来标记恶意软件家族来达到各种目的。</a></p>
<p>yara的安装也是十分的简单，如win下已有独立文件，下载使用即可。</p>
<p><img src="../images/yara/0.png" alt="0.png"></p>
<p>下面是一个简单的yara规则的demo：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">rule silent_banker : banker</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;This is just an example&quot;</span><br><span class="line">        threat_level = 3</span><br><span class="line">        in_the_wild = true</span><br><span class="line">    strings:</span><br><span class="line">        $a = &#123;6A 40 68 00 30 00 00 6A 14 8D 91&#125;</span><br><span class="line">        $b = &#123;8D 4D B0 2B C1 83 C0 27 99 6A 4E 59 F7 F9&#125;</span><br><span class="line">        $c = &quot;UVODFRYSIHLNWPEJXQZAKCBGMT&quot;</span><br><span class="line">    condition:</span><br><span class="line">        $a or $b or $c</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>yara规则不需要太多知识要求，规则本身十分简单, 真正的技巧和细节都在分析部分 </p>
<h2 id="yara规则"><a href="#yara规则" class="headerlink" title="yara规则"></a>yara规则</h2><p>yara的规则跟许多语言的语法颇为类似，学习起来也没有那么的困难。下面就是一个基础的yara规则框架：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">    strings:    </span><br><span class="line">    condition:</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>然后将其保存为yara文件即可。当然该规则没有进行任何操作。一般一个yara文件分为上述的三个部分，meta、strings、condition，并以rule包裹。rule后跟rule名字。关于rule名字有以下要求：</p>
<ul>
<li>英文或字母组成的字符串</li>
<li>可以使用下划线</li>
<li>第一个字符禁止为数字</li>
<li>大小写敏感</li>
<li>不可以大于128个字符长度</li>
</ul>
<ul>
<li>meta部分：主要为该规则的基础信息，如作者信息、创建时间、样本内容等</li>
<li>strings部分：主要用来定义字符串支持正则表达式，用来配合下面的部分使得规则生效。</li>
<li>condition部分：主要来编写表达式来处理strings部分的字符串。</li>
</ul>
<h2 id="yara关键词"><a href="#yara关键词" class="headerlink" title="yara关键词"></a>yara关键词</h2><p>在yara中有一些词不可作为标识符，因为在yara中有特殊用途。</p>
<blockquote>
<p>all、and、or、at、int32、wide、not….</p>
</blockquote>
<p>具体的可以去查找yara文档，这里不再赘述。</p>
<h3 id="字符串"><a href="#字符串" class="headerlink" title="字符串"></a>字符串</h3><p>在yara中字符串的表示主要由十六进制与文本字符串组成。</p>
<h4 id="十六进制字符串："><a href="#十六进制字符串：" class="headerlink" title="十六进制字符串："></a>十六进制字符串：</h4><p>在十六进制字符串中可以使用通配符表示，通配符为“?”.demo如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &#123; EF 44 ?? D8 A? FB&#125;   </span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>则它可以匹配以下字符串：</p>
<blockquote>
<p>EF 44 01 D8 AA FB</p>
</blockquote>
<p><img src="../images/yara/1.png" alt="0.png"></p>
<p>不定长字符串可以用[4-6]这类形式表示，而无限长的字符串可以用[-]表示</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &#123; EF 44 [-] D8 A2 FB&#125; </span><br><span class="line">        $hex2 = &#123; EF 44 [4-6] D8 A2 FB&#125;    </span><br><span class="line">    condition:</span><br><span class="line">        $hex1 or $hex2</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h4 id="文本字符串："><a href="#文本字符串：" class="headerlink" title="文本字符串："></a>文本字符串：</h4><p>这个就没啥好说的了，利用文本来匹配字符串，比如mimikatz的logonpasswords等</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;honghe&quot;   </span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="../images/yara/2.png" alt="0.png"></p>
<p>注：转义字符依旧适用。</p>
<h3 id="修饰符"><a href="#修饰符" class="headerlink" title="修饰符"></a>修饰符</h3><p>yara提供了丰富的修饰符来方便匹配，如不区分大小写的nocase：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;honghe&quot;  nocase </span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>宽字符的wide：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;honghe&quot; wide</span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>匹配base64的base64：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;honghe&quot; base64</span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>它将会匹配下面的字符串：</p>
<blockquote>
<p>aG9uZ2hl</p>
</blockquote>
<p>全词匹配的fullword：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;facebook&quot; fullword</span><br><span class="line">    condition:</span><br><span class="line">        $hex1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>将匹配:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">www.facebook.com</span><br><span class="line">www.xor.facebook.com</span><br><span class="line">https://www.facebook.com/</span><br></pre></td></tr></table></figure>
<h3 id="正则表达式"><a href="#正则表达式" class="headerlink" title="正则表达式"></a>正则表达式</h3><p>这个就不再多说了，唯一要注意的就是使用//来包裹正则表达式，类似于perl语法。</p>
<h3 id="条件"><a href="#条件" class="headerlink" title="条件"></a>条件</h3><h4 id="布尔运算"><a href="#布尔运算" class="headerlink" title="布尔运算"></a>布尔运算</h4><p>使用and or not等关键字来使字符串充当布尔变量</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings: </span><br><span class="line">        $hex1 = &quot;facebook&quot;</span><br><span class="line">        $hex2 = &quot;book&quot;</span><br><span class="line">        $hex3 = &quot;face&quot;</span><br><span class="line">    condition:</span><br><span class="line">        ($hex1 and $hex2) or $hex3</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="文件大小"><a href="#文件大小" class="headerlink" title="文件大小"></a>文件大小</h3><p>yara使用filesize来进行文件大小的匹配，大小以字节为单位</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    condition:</span><br><span class="line">        filesize &gt; 200KB</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="可执行程序入口点"><a href="#可执行程序入口点" class="headerlink" title="可执行程序入口点"></a>可执行程序入口点</h3><p>假如你扫描的文件是一个pe文件或者是一个elf文件时，你可以使用entry_point来进行表示程序的入口点。新版本中已将它归入了PE模块当中，不再单独使用。</p>
<h3 id="访问指定位置的数据"><a href="#访问指定位置的数据" class="headerlink" title="访问指定位置的数据"></a>访问指定位置的数据</h3><p>如果你想从特定偏移位置读取数据, 并将其存为一个变量. 那么你可以使用以下任何一个方式:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">int8(&lt;offset or virtual address&gt;)</span><br><span class="line">int16(&lt;offset or virtual address&gt;)</span><br><span class="line">int32(&lt;offset or virtual address&gt;)</span><br><span class="line"> </span><br><span class="line">uint8(&lt;offset or virtual address&gt;)</span><br><span class="line">uint16(&lt;offset or virtual address&gt;)</span><br><span class="line">uint32(&lt;offset or virtual address&gt;)</span><br><span class="line"> </span><br><span class="line">int8be(&lt;offset or virtual address&gt;)</span><br><span class="line">int16be(&lt;offset or virtual address&gt;)</span><br><span class="line">int32be(&lt;offset or virtual address&gt;)</span><br><span class="line"> </span><br><span class="line">uint8be(&lt;offset or virtual address&gt;)</span><br><span class="line">uint16be(&lt;offset or virtual address&gt;)</span><br><span class="line">uint32be(&lt;offset or virtual address&gt;)</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">rule RuleName</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    condition:</span><br><span class="line">        unint16(0) and unit32(unit32(0x3c)) == 0x00004550</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="../images/yara/3.png" alt="0.png"></p>
<p>以上就是基本的yara规则的语法了，而在正式的编写中呢，可能并不需要这么负责的内容，比如我们以某rat的规则为例：</p>
<p><img src="../images/yara/4.png" alt="0.png"></p>
<p>就是简单的三条url地址，然后使用or进行匹配，而这些url地址也可以使用pestudio来查看：</p>
<p><img src="../images/yara/5.png" alt="0.png"></p>
<p>并不需要太多的逆向知识，除此之外vt也有相关的功能：</p>
<p><img src="../images/yara/6.png" alt="0.png"></p>
<p>唯一的难点就是需要大量的样本来确定，该家族的样本都是使用的该url。<br>更简单的可能就像下面这样</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">rule hacktool_windows_mimikatz_copywrite</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;Mimikatz credential dump tool: Author copywrite&quot;</span><br><span class="line">        reference = &quot;https://github.com/gentilkiwi/mimikatz&quot;</span><br><span class="line">        author = &quot;@fusionrace&quot;</span><br><span class="line">        md5_1 = &quot;0c87c0ca04f0ab626b5137409dded15ac66c058be6df09e22a636cc2bcb021b8&quot;</span><br><span class="line">        md5_2 = &quot;0c91f4ca25aedf306d68edaea63b84efec0385321eacf25419a3050f2394ee3b&quot;</span><br><span class="line">        md5_3 = &quot;0fee62bae204cf89d954d2cbf82a76b771744b981aef4c651caab43436b5a143&quot;</span><br><span class="line">        md5_4 = &quot;004c07dcd04b4e81f73aacd99c7351337f894e4dac6c91dcfaadb4a1510a967c&quot;</span><br><span class="line">        md5_5 = &quot;09c542ff784bf98b2c4899900d4e699c5b2e2619a4c5eff68f6add14c74444ca&quot;</span><br><span class="line">        md5_6 = &quot;09054be3cc568f57321be32e769ae3ccaf21653e5d1e3db85b5af4421c200669&quot;</span><br><span class="line">    strings:</span><br><span class="line">        $s1 = &quot;Kiwi en C&quot; fullword ascii wide</span><br><span class="line">        $s2 = &quot;Benjamin DELPY `gentilkiwi`&quot; fullword ascii wide</span><br><span class="line">        $s3 = &quot;http://blog.gentilkiwi.com/mimikatz&quot; fullword ascii wide</span><br><span class="line">        $s4 = &quot;Build with love for POC only&quot; fullword ascii wide</span><br><span class="line">        $s5 = &quot;gentilkiwi (Benjamin DELPY)&quot; fullword wide</span><br><span class="line">        $s6 = &quot;KiwiSSP&quot; fullword wide</span><br><span class="line">        $s7 = &quot;Kiwi Security Support Provider&quot; fullword wide</span><br><span class="line">        $s8 = &quot;kiwi flavor !&quot; fullword wide</span><br><span class="line">    condition:</span><br><span class="line">        any of them</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>但对于mimikatz来说，的确简单有效</p>
<h2 id="yara编写"><a href="#yara编写" class="headerlink" title="yara编写"></a>yara编写</h2><p>我们以CobaltStrike为例，从分析开始一步步的编写一个yara规则出来。</p>
<p>首先就是文件大小，CobaltStrike生成的马一般都很小，所以我们第一条规则便可以针对马的大小来做限制：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">rule CobaltStrike4_1:beacon</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;This rule is used to detect CobaltStrike4.1 Trojan&quot;</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    condition:</span><br><span class="line">       filesize &gt; 10KB and filesize &lt; 24KB</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="../images/yara/7.png" alt="0.png"></p>
<p>然后便是分析阶段，将cs的马子放入cutter进行分析，发现入口点基本一样：</p>
<p><img src="../images/yara/8.png" alt="0.png"></p>
<p>将其转换为汇编代码，发现入口点的main的结构相同</p>
<p><img src="../images/yara/9.png" alt="0.png"></p>
<p>继续跟进，发现入口点为0x004014b0 ，然后减去0xc，那么入口点基本就是14B0的位置：</p>
<p><img src="../images/yara/10.png" alt="0.png"></p>
<p>在这里也可以印证我们的猜想</p>
<p><img src="../images/yara/11.png" alt="0.png"></p>
<p>之前说过可以使用pe模块来标识文件的入口点，不过不是使用我们这里的地址，而是需要文件偏移：</p>
<p><img src="../images/yara/12.png" alt="0.png"></p>
<p>即000008B0也就是0x8b0</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">import &quot;pe&quot;</span><br><span class="line">rule CobaltStrike4_1:beacon</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;This rule is used to detect CobaltStrike4.1 Trojan&quot;</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    condition:</span><br><span class="line">      pe.entry_point ==0x8b0 and filesize &gt; 10KB and filesize &lt; 24KB</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="../images/yara/13.png" alt="0.png"></p>
<p>那么这样简单的规则就算写完了，我们继续编写，在查看PE的过程中，我发现其中有一些奇奇怪怪的字符串：</p>
<p><img src="../images/yara/14.png" alt="0.png"></p>
<p>看起来像是一些通信协议，我们回到cutter，查看main函数;</p>
<p><img src="../images/yara/15.png" alt="0.png"></p>
<p>跳到401840，在该地址中可以看到我们的字符串，以及使用CreateThread来新建线程</p>
<p><img src="../images/yara/16.png" alt="0.png"></p>
<p>这里CreateThread的地址为406148，在401648中可以看到正在使用CreateNamedPipeA进行管道通信：</p>
<p><img src="../images/yara/17.png" alt="0.png"></p>
<p>通过附加多个线程，发现均存在该字符串，则在规则中匹配即可：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">import &quot;pe&quot;</span><br><span class="line">rule CobaltStrike4_1:beacon</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;This rule is used to detect CobaltStrike4.1 Trojan&quot;</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings:</span><br><span class="line">         $name = &quot;%c%c%c%c%c%c%c%c%cMSSE-%d-server&quot;</span><br><span class="line">    condition:</span><br><span class="line">      pe.entry_point ==0x8b0 and filesize &gt; 10KB and filesize &lt; 24KB and $name</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><img src="../images/yara/18.png" alt="0.png"></p>
<p>最后使用uint16来判断一下是否为pe文件即可，最后的yara规则如下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">import &quot;pe&quot;</span><br><span class="line">rule CobaltStrike4_1:beacon</span><br><span class="line">&#123;</span><br><span class="line">    meta:</span><br><span class="line">        description = &quot;This rule is used to detect CobaltStrike4.1 Trojan&quot;</span><br><span class="line">        author = &quot;lengyi&quot;</span><br><span class="line">    strings:</span><br><span class="line">         $name = &quot;%c%c%c%c%c%c%c%c%cMSSE-%d-server&quot;</span><br><span class="line">    condition:</span><br><span class="line">         uint16(0) == 0x5A4D and pe.entry_point ==0x8b0 and filesize &gt; 10KB and filesize &lt; 24KB and $name</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>然后在一些威胁情报网站随便下了几个样本，三个检出了两个：</p>
<p><img src="../images/yara/19.png" alt="0.png"></p>
<p>还是很不错的。</p>
<p>参考文章：</p>
<p><a href="https://yara.readthedocs.io/en/stable/writingrules.html#more-about-rules" target="_blank" rel="noopener">https://yara.readthedocs.io/en/stable/writingrules.html#more-about-rules</a><br><a href="https://www.youtube.com/watch?v=35Exd9GrR5I&amp;ab_channel=HackerSploit" target="_blank" rel="noopener">https://www.youtube.com/watch?v=35Exd9GrR5I&amp;ab_channel=HackerSploit</a><br><a href="https://www.anquanke.com/post/id/211501#h3-8" target="_blank" rel="noopener">https://www.anquanke.com/post/id/211501#h3-8</a></p>

      
    </div>

    

    
    
    

    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/yara/">使用yara防御恶意软件</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 冷逸 的个人博客">冷逸</a></p>
  <p><span>发布时间:</span>2020年10月11日 - 19:10</p>
  <p><span>最后更新:</span>2020年10月11日 - 20:10</p>
  <p><span>原始链接:</span><a href="/yara/" title="使用yara防御恶意软件">https://lengjibo.github.io/yara/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://lengjibo.github.io/yara/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
    $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
    });
    });  
</script>


      
    </div>
    <div>
      
        <div>
    
        <div style="text-align:center;color: #555;font-size:14px;">-------------The End-------------</div>
    
</div>

      
    </div>
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechat.png" alt="冷逸 WeChat Pay"/>
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/zhifubao.jpg" alt="冷逸 Alipay"/>
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Persistence/" rel="tag"><i class="fa fa-tag"></i> Persistence</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div class="social_share">
            
               <div>
                 
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='//bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

               </div>
            
            
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/qipai/" rel="next" title="记一次棋牌站的沦陷">
                <i class="fa fa-chevron-left"></i> 记一次棋牌站的沦陷
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/guopqing/" rel="prev" title="国庆国庆">
                国庆国庆 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Inhaltsverzeichnis
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Übersicht
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="http://ww1.sinaimg.cn/large/007F8GgBly1g7vony4ltaj308w08wq30.jpg"
                alt="冷逸" />
            
              <p class="site-author-name" itemprop="name">冷逸</p>
              <p class="site-description motion-element" itemprop="description">做一个温柔的人...</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">113</span>
                    <span class="site-state-item-name">Artikel</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">Kategorien</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">120</span>
                    <span class="site-state-item-name">Tags</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/../../.deploy_git/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/lengjibo" target="_blank" title="GitHub"><i class="fa fa-fw fa-globe"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="qqlengyi@163.com" target="_blank" title="E-Mail"><i class="fa fa-fw fa-globe"></i>E-Mail</a>
                  
                </span>
              
            </div>
          
        <div id="music163player">
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=110 src="https://music.163.com/outchain/player?type=0&id=377079922&auto=1&height=90"></iframe>
          </div>
          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://sqlmap.wiki/" title="青春's blog" target="_blank">青春's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.addon.pub/" title="Yokeen's blog" target="_blank">Yokeen's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://freeerror.org/" title="之乎者也's blog" target="_blank">之乎者也's blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.bugbank.cn/team/FrigidSword" title="漏洞银行" target="_blank">漏洞银行</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.vulbox.com/team/Frigid%20Sword%E5%AE%89%E5%85%A8%E5%9B%A2%E9%98%9F" title="漏洞盒子" target="_blank">漏洞盒子</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://godpang.github.io/" title="Mr.赵" target="_blank">Mr.赵</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://amliaw4.github.io/" title="amliaW4'S Blog" target="_blank">amliaW4'S Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.se7ensec.cn/" title="se7en's Blog" target="_blank">se7en's Blog</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://ninjia.gitbook.io/secskill/" title="secskill" target="_blank">secskill</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.bug1024.cn/" title="ibug" target="_blank">ibug</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="http://wwcx.org/" title="Strjziny's Blog" target="_blank">Strjziny's Blog</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#yara简介"><span class="nav-number">1.</span> <span class="nav-text">yara简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yara规则"><span class="nav-number">2.</span> <span class="nav-text">yara规则</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yara关键词"><span class="nav-number">3.</span> <span class="nav-text">yara关键词</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#字符串"><span class="nav-number">3.1.</span> <span class="nav-text">字符串</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#十六进制字符串："><span class="nav-number">3.1.1.</span> <span class="nav-text">十六进制字符串：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#文本字符串："><span class="nav-number">3.1.2.</span> <span class="nav-text">文本字符串：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#修饰符"><span class="nav-number">3.2.</span> <span class="nav-text">修饰符</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#正则表达式"><span class="nav-number">3.3.</span> <span class="nav-text">正则表达式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#条件"><span class="nav-number">3.4.</span> <span class="nav-text">条件</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#布尔运算"><span class="nav-number">3.4.1.</span> <span class="nav-text">布尔运算</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文件大小"><span class="nav-number">3.5.</span> <span class="nav-text">文件大小</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#可执行程序入口点"><span class="nav-number">3.6.</span> <span class="nav-text">可执行程序入口点</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#访问指定位置的数据"><span class="nav-number">3.7.</span> <span class="nav-text">访问指定位置的数据</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yara编写"><span class="nav-number">4.</span> <span class="nav-text">yara编写</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2014 – <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">冷逸</span>

  

  
</div>




  <div class="powered-by">Erstellt mit  <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Muse</a> v6.4.0</div>






        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="Total Visitors">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="Total Views">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  







  
  







  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.jsdelivr.net/velocity/1.2.3/velocity.ui.min.js"></script>
  

  
  
    <script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.1/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/canvas_sphere.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

<script src="/live2dw/lib/L2Dwidget.min.js?0c58a1486de42ac6cc1c59c7d98ae887"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
<script type="text/javascript" src="/js/src/love.js"></script>
